<!DOCTYPE html>
<!-- 
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.1.1
Version: 2.0.2
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: support@keenthemes.com
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<!--<![endif]-->
<!-- BEGIN HEAD -->
<!-- BEGIN BODY -->
<body class="page-header-fixed">
	<!-- BEGIN PAGE CONTENT-->
	<div class="site_content">
		<div class="realtime_content content_box no_table_filter">
			<div>
				<form class="instruct_box" id="formid" method="post">
					<hr />
					<div>
						<div class="form-group form1 row">
							<div class="col-sm-6">
								<label class="col-sm-2">生效类型</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="effect_type"
										name="effect_type" placeholder="请输入生效类型" readonly="">
								</div>
								<span class="textspan">例如：00：立即生效 01:延时生效</span>
							</div>
							<div class="col-sm-6">
								<label class="col-sm-2">生效时间</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="effect_time"
										name="effect_time" placeholder="请输入生效时间" readonly="">
								</div>
								<span class="textspan">例如：20151112011236代表2015年11月12日01时12分36秒</span>
							</div>
						</div>
						<div class="form-group form1 row">
							<div class="col-sm-6">
								<label class="col-sm-2">设备地址</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="chargerId"
										name="chargerId" placeholder="请输入16位设备地址">
								</div>
							</div>
						</div>
						<div class="form-group form1 row">
							<div class="col-sm-6">
								<label class="col-sm-2">1号ip地址</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="main_hardware_ip"
										name="main_hardware_ip" placeholder="请输入ip地址">
								</div>
							</div>
							<div class="col-sm-6">
								<label class="col-sm-2">2号ip地址</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="back_headware_ip"
										name="back_headware_ip" placeholder="请输入ip地址" readonly="">
								</div>
							</div>
						</div>
						<div class="form-group form1 row">
							<div class="col-sm-6">
								<label class="col-sm-2">1号端口号</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="main_port"
										name="main_port" placeholder="请输入4位端口号">
								</div>
							</div>
							<div class="col-sm-6">
								<label class="col-sm-2">2号端口号</label>
								<div class="col-sm-10">
									<input type="text" class="form-control" id="back_port"
										name="back_port" placeholder="请输入4位端口号" readonly="">
								</div>
							</div>
						</div>
						<div class="form-group form1 row">
							<div class="col-sm-6">
								<label class="col-sm-2">版本号</label>
								<div class="col-sm-10">
									<select class="form-control" id="protocol_version"
										name="protocol_version" readonly="">
										<option value="0101">0101</option>
<!-- 										<option value="0102">0102</option>
										<option value="0103" selected="">0103</option> -->
									</select>
								</div>
							</div>
						</div>
						<div class="modal-footer t_c">
							<button type="reset" class="btn btn-warning" data-dismiss="modal">
								<i class="fa fa-refresh"></i> 重置
							</button>
							<button type="button" class="btn btn-primary">
								<i class="fa fa-cog"></i> 设置
							</button>
							<input type="submit" id="setip" class="btn btn-primary" value="下发硬件ip地址">
						</div>
				</form>
			</div>
		</div>
	</div>
	<!-- END PAGE CONTENT-->
</body>
<script>
	$('button.btn-primary').on('click',function(){
		$.ajax({
			type:'post',
			//url:'../../userApi/login',
			url:'../setHardwareServerIp',
			//data:{"chargerId":$('#chargerId').val(),"ip":$('#main_hardware_ip').val(),"port":$('#main_port').val()},
			data:$('#formid').serialize(),
			dataType: "json",
			async: false,
			success:function(data){
				if(data.code == '200'){
					bootboxWindow.alert("指令下发成功!", null);
				}else{
					bootboxWindow.alert("指令下发失败!", null);
				}
			}
		})
	});
//
	$('#setip').on('click',function(){
		$.ajax({
			type:'post',
			//url:'../../userApi/login',
			url:'../setip',
			data:{"chargerId":$('#chargerId').val(),"ip":$('#main_hardware_ip').val(),"port":$('#main_port').val()},
			// data:$('#formid').serialize(),
			dataType: "json",
			async: false,
			success:function(data){
				if(data.code == '200'){
					bootboxWindow.alert("指令下发成功!", null);
				}else{
					bootboxWindow.alert("指令下发失败!", null);
				}
			}
		})
	});
</script>
</html>
